package com.cskaoyan.mall.dao;

import com.cskaoyan.mall.model.po.Criticism;
import com.cskaoyan.mall.model.po.GoodsAndSpec;
import com.cskaoyan.mall.model.po.Order;
import com.cskaoyan.mall.model.po.User;
import com.cskaoyan.mall.model.vo.order.*;
import lombok.Data;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @ClassName: OrderMapper
 * @Description: TODO
 * @Auther 庄左
 * @Date 2022/7/1 16:43
 * @Version
 **/
public interface OrderMapper {


    List<OrderMessageVo> selectOrderMessage(Order order);

    UserOrderMessageVo selectUserMessage(@Param("userId") Integer id,@Param("orderId") Integer orderId);

    //查询所有
    List<OrderSpec> selectSpecList(Integer id);
    List<OrderStates> selectStateList();

    //查询当前
    CurSpec selectCurSpec(Integer id);
    CurState selectCurState(Integer id);

    OrderUpdate selectorderUpdate(Integer id);

    String selectStateById( Integer id);
    String selectSpecById(Integer id);
    void changeOrder(Order order);

    void deleteOrder(Integer id);

    Integer selectGoodsIdByOrderId(Integer id);


    //============================购物车的订单及商品===========================//

    List<CartOrderVo> selectCartOrderByStateId(@Param("stateId") Integer stateId,@Param("name") String name);
    //购物车中的商品
    // CartGoodVo selectCartGoodByOrderId(Integer orderId);


//===============================================加入购物车要办的手续=================================================//

    //根据发货状态id，拿到发货状态stateValue 返回一个String
    String selectStateValueByStateId(Integer stateId);


    //根据规格id拿到 规格spec，商品id
    GoodsAndSpec selectGoodsIdAndSpecMessageBySpecId(Integer specId);
    //根据商品id拿到商品的名称和图片 goods img
    GoodsAndSpec selectGoodsMessageByGoodsId(Integer goodsId);

    //根据昵称拿到用户的id，用户名，收件人，地址，电话
    User selectUserMessageByUserNickName(String nikeName);

    //加入购物车
    void insertGoodsToCart(@Param("orders") Order order);

    void updateStockNumInSpec(@Param("stockNum") Integer stockNum, @Param("specId") Integer specId);

    void updateOrderStateIdAndState();

    void updateOrderStateByOrderIdFromPay(Integer id);

    int  insertCriitism(Criticism criticism);

    String selectUserIdByUserNickName(String userNickName);

    int updateOrderHasComment(Integer id);

    int updateOrderStateByOrderIdFromConfirmReceive(Integer id);
}
